﻿<catel:Page 
    x:Class="LprMiddleWare.Views.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
      xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" 
            xmlns:Views="clr-namespace:LprMiddleWare.Views"
            xmlns:catel="http://catel.codeplex.com" mc:Ignorable="d"
            xmlns:ViewModels="clr-namespace:LprMiddleWare.ViewModels"
    xmlns:ValueConverters="clr-namespace:LprMiddleWare.ValueConverters"
    Title="MainPage"
      d:DesignHeight="355"
      d:DesignWidth="411">
    <Page.Resources>
        <ValueConverters:DetectMethodConverter x:Key="DetectMethodConverter" />
        <ValueConverters:ColorConverter x:Key="ColorConverter" />
        <ValueConverters:KzCarTypeConverter x:Key="CarTypeConverter" />
        <DataTemplate x:Key="DataTemplateLogEntry">

            <TextBlock TextWrapping="Wrap"
                       d:LayoutOverrides="Width, Height">
                    <Run Text="[" />
                    <Run Text="{Binding LogTime}" />
                    <Run Text="]:" />
                    <Run Text="{Binding Message}" />
            </TextBlock>

        </DataTemplate>
    </Page.Resources>

    <TabControl>
        <TabItem Header="实时图片">
            <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="3*" />
        </Grid.RowDefinitions>
        <Image   x:Name="imageEdit1"
                 Source="{Binding CurrentImage}" />
        <Border x:Name="LprContainer" VerticalAlignment="Bottom" Background="Black" Opacity="0"
                        MouseEnter="Border_MouseEnter"
                        MouseLeave="Border_MouseLeave">
            <Grid x:Name="LicensePlate">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"
                                      MinWidth="60.003" />
                    <ColumnDefinition Width="Auto"
                                      MinWidth="82.494" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto"
                                      MinWidth="54.636" />
                    <ColumnDefinition Width="Auto"
                                      MinWidth="78.695" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding CurrentPlate.LicenseNumber}"
                           x:Name="LicensePlateNumber"
                           FontSize="34.667"
                           Grid.Column="2"
                           Grid.RowSpan="2"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Top"
                           Margin="0,8,0,0" Foreground="#FFE7D724" />
                <Label Content="监控点编号:" Foreground="#FFE7D724" FontSize="18.667" />
                <Label Content="相机编号:"
                       Grid.Row="1" Foreground="#FFE7D724" FontSize="18.667" />
                <Label Content="方向:"
                       Grid.Column="3" Foreground="#FFE7D724" FontSize="18.667" />
                <TextBlock x:Name="DeviceId"
                           Text="{Binding CurrentPlate.DeviceId}"
                           Grid.Column="1"
                           VerticalAlignment="Center" Foreground="#FFE7D724" FontSize="18.667" />
                <TextBlock x:Name="LaneNo"
                           Text="{Binding CurrentPlate.CameraNo}"
                           Grid.Column="1"
                           Grid.Row="1"
                           VerticalAlignment="Center" Foreground="#FFE7D724" FontSize="18.667" />
                <TextBlock x:Name="CaptureTime"
                           Text="{Binding CurrentPlate.CaptureTime, StringFormat=MM-dd HH:mm:ss}"
                           Grid.Column="2"
                           Padding="0,0,12,0"
                           Grid.Row="2"
                           d:LayoutOverrides="Width, Height"
                           RenderTransformOrigin="0.464,-1.805"
                           VerticalAlignment="Center"
                           HorizontalAlignment="Center" Foreground="#FFE7D724" FontSize="18.667" />
                <Label Content="检测方式："
                       Grid.Column="3"
                       Grid.Row="1"
                       d:LayoutOverrides="Height" Foreground="#FFE7D724" FontSize="18.667" />
                <TextBlock x:Name="CaptureTime_Copy"
                                   Text="{Binding CurrentPlate.DetectMethod, Converter={StaticResource DetectMethodConverter}}"
                           Grid.Column="4"
                           Grid.Row="1"
                           d:LayoutOverrides="Height"
                           VerticalAlignment="Center" Foreground="#FFE7D724" FontSize="18.667" />
                <Label Content="车道编号:"
                       Grid.Row="2"
                       d:LayoutOverrides="Width, GridBox" Foreground="#FFE7D724" FontSize="18.667" />
                <Label Content="车牌颜色:"
                       Grid.Row="3" Foreground="#FFE7D724" FontSize="18.667" />
                <Label Content="车速:"
                       Grid.Row="2"
                       Grid.Column="3" Foreground="#FFE7D724" FontSize="18.667" />
                <Label Content="限速值:"
                       Grid.Row="3"
                       Grid.Column="3" Foreground="#FFE7D724" FontSize="18.667" />
                <TextBlock x:Name="LaneNo_Copy"
                           Text="{Binding CurrentPlate.LaneNo}"
                           Grid.Column="1"
                           Grid.Row="2"
                           d:LayoutOverrides="Height"
                           VerticalAlignment="Center" Foreground="#FFE7D724" FontSize="18.667" />
                <TextBlock x:Name="LaneNo_Copy1"
                           Text="{Binding CurrentPlate.PlateColor, Converter={StaticResource ColorConverter}}"
                           Grid.Column="1"
                           Grid.Row="3"
                           d:LayoutOverrides="Height"
                           VerticalAlignment="Center" Foreground="#FFE7D724" FontSize="18.667" />
                <TextBlock x:Name="LaneNo_Copy2"
                           Text="{Binding CurrentPlate.Speed}"
                           Grid.Column="4"
                           Grid.Row="2"
                           d:LayoutOverrides="Height"
                           VerticalAlignment="Center" Foreground="#FFE7D724" FontSize="18.667" />
                <TextBlock x:Name="LaneNo_Copy3"
                           Text="{Binding CurrentPlate.SpeedLimit}"
                           Grid.Column="4"
                           Grid.Row="3"
                           d:LayoutOverrides="Height"
                           VerticalAlignment="Center" Foreground="#FFE7D724" FontSize="18.667" />
                <TextBlock x:Name="CaptureTime_Copy1"
                           Text="{Binding CurrentPlate.Direction}"
                           Grid.Column="4"
                           Padding="0,0,12,0"
                           d:LayoutOverrides="Width, Height"
                           VerticalAlignment="Center" Foreground="#FFE7D724" FontSize="18.667" />
                        <Label Content="车型:"
                       Grid.Row="4"
                       Grid.Column="0" Foreground="#FFE7D724" FontSize="18.667" />
                        <TextBlock x:Name="CarType"
                           Text="{Binding CurrentPlate.CarType, Converter={StaticResource CarTypeConverter}}"
                           Grid.Column="1"
                           Grid.Row="4"        
                           Padding="0,0,12,0"
                           d:LayoutOverrides="Width, Height"
                           VerticalAlignment="Center" Foreground="#FFE7D724" FontSize="18.667" />
                    </Grid>
        </Border>
            </Grid> 
        </TabItem>
        <TabItem Header="日志">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="5" />
                        <RowDefinition  />
                    </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal">
                    <Button Width="75" HorizontalAlignment="Left" Content="清除日志" Command="{Binding ClearLogCommand}" />
                    <CheckBox Margin="5, 0, 0, 0" HorizontalAlignment="Left" VerticalAlignment="Center" Content="刷新日志" IsChecked="{Binding EnableRefreshingLog}" />
                </StackPanel>
                <ListBox Grid.Row="2" ItemTemplate="{DynamicResource DataTemplateLogEntry}"
                             MinHeight="100"
                             ItemsSource="{Binding Logs}" />
                </Grid>
                    
        </TabItem>
    </TabControl>
</catel:Page>
